package com.example.mapper;

import com.example.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {
    @Select("select * from user where username = #{username}")
    User findByUserName(String username);

    @Insert("insert into user(username,password) values (#{username},#{password})")
    void addNewUser(String username, String password);

    @Update("update user set nickname = #{nickname},email = #{email} where id = #{id}")
    int updateUserInfo(User user);

    @Update("update user set user_pic = #{url} where id = #{id}")
    void updateAvatar(String url, Integer id);

    @Update("update user set password = #{newPwd} where id = #{id}")
    void updatePwd(String newPwd,Integer id);
}
